//
//  CJTStoryDetailHeaderView.m
//  BreadTravel
//
//  Created by dllo on 15/12/22.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "CJTStoryDetailHeaderView.h"

@implementation CJTStoryDetailHeaderView

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

-(void)createSubView
{
    UIView *aView = [[UIView alloc] init];
    [self addSubview:aView];
    [aView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(@0);
        make.height.mas_equalTo(@100);
    }];
    self.headImageView = [[UIImageView alloc] init];
    [aView addSubview:self.headImageView];

    [self.headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(@20);
        make.width.mas_equalTo(@60);
        make.height.mas_equalTo(@60);
            }];
    //设置半径
    self.headImageView.layer.cornerRadius = 30;
    //裁掉边框
    self.headImageView.layer.masksToBounds = YES;
    
    self.label = [[UILabel alloc] init];
    [self addSubview:self.label];
    self.label.numberOfLines = 0;
    [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headImageView.mas_right).offset(20).priority(900);
        make.left.mas_equalTo(@20).priority(500);
        make.top.equalTo(self.mas_top).offset(30);
        make.right.mas_equalTo(@(-10));
    }];
    
    
    
    self.lineView = [[UIView alloc] init];
    [aView addSubview:self.lineView];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(@10);
        make.right.mas_equalTo(@(-10));
        make.top.mas_equalTo(@98);
        make.height.mas_equalTo(@2);
        
    }];
    self.lineView.backgroundColor = [UIColor lightGrayColor];


}





//-(void)layoutSubviews
//{
//    [self.label mas_updateConstraints:^(MASConstraintMaker *make) {
//        
//        make.left.mas_equalTo(@20);
//        make.top.equalTo(self.mas_top).offset(10);
//        make.right.mas_equalTo(@(-20));
//        
//    }];
//    
//    
//    
//    
//}




/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
